from django.db import models
from storehouse.models import Storehouse


# Create your models here.
class System(models.Model):
    storehouse = models.ForeignKey(
        Storehouse,
        verbose_name=u"所属仓库",
        on_delete=models.CASCADE,
        related_name='storehouse_system',
    )
    cpu = models.CharField(
        max_length=30,
        verbose_name=u'cpu占有率',
        default=u'',
        null=True
    )
    ram = models.CharField(
        max_length=30,
        verbose_name=u'内存占有率',
        default=u'',
    )
    ramTotal = models.CharField(
        max_length=30,
        verbose_name=u'内存总',
        default=u'',
    )
    ramUsed = models.CharField(
        max_length=30,
        verbose_name=u'内存已用',
        default=u'',
    )
    caliche = models.CharField(
        max_length=30,
        verbose_name=u'硬盘占有率',
        default=u'',
    )
    calicheTotal = models.CharField(
        max_length=30,
        verbose_name=u'硬盘总',
        default=u'',
    )
    calicheUsed = models.CharField(
        max_length=30,
        verbose_name=u'硬盘已用',
        default=u'',
    )
    createTime = models.DateTimeField(
        auto_now=True,
        verbose_name=u"创建时间",
    )
    isActive = models.BooleanField(
        verbose_name=u'是否活跃',
        default=True,
    )

    def __unicode__(self):
        return self.createTime

    class Meta:
        ordering = ('createTime',)
